<template>
  <div class="risk">
    <!-- <div class="add" @click="add">新增</div> -->
    <eagle-page-list
      ref="eaglePageList"
      @bindData="bindData"
      :queryParams="queryParams"
      :url="url"
      :conditions="conditions"
      placeholder="请输入隐患描述、所属任务、检查人搜索"
    >
      <template #list>
        <eagle-cell
          style="margin-top: 10px"
          class="br-8"
          v-for="(item, index) in list"
          :key="index"
        >
          <div class="warn_item">
            <div @click="goDetail(item)">
              <div class="warn_header">
                <div>{{ index + 1 }}、隐患描述：{{ item.HiddenDangerDesc }}</div>
                <eagle-tag
                  v-if="item.ExpireDays < 0"
                  class="warn_tag"
                  type="warning"
                  >剩{{ Math.abs(item.ExpireDays) }}</eagle-tag
                >
                <eagle-tag
                  v-if="item.ExpireDays > 0"
                  class="warn_tag"
                  type="warning"
                  >逾期{{ Math.abs(item.ExpireDays) }}</eagle-tag
                >
              </div>
              <eagle-row gutter="20" class="dep_sort">
                <eagle-col span="24">
                  <img
                    src="@/assets/Images/AppIcon/icon_list_org.png"
                    alt=""
                  />所属任务：{{ item.CheckTaskName }}</eagle-col
                >
              </eagle-row>

              <eagle-row gutter="20" class="dep_sort">
                <eagle-col span="12">
                  <img
                    src="@/assets/Images/AppIcon/icon_list_post.png"
                    alt=""
                  />{{
                    item.OriginType == 1
                      ? "检查表检查"
                      : item.StatusName == 2
                      ? "依据检查"
                      : "随手拍"
                  }}</eagle-col
                >
              </eagle-row>

              <eagle-row class="dep_sort">
                <eagle-col span="8">
                  <img
                    src="@/assets/Images/AppIcon/icon_list_security.png"
                    alt=""
                  />{{ item.CreateChnName }}</eagle-col
                >
                <eagle-col span="16">
                  <img
                    src="@/assets/Images/AppIcon/icon_list_security.png"
                    alt=""
                  />{{ item.CreateDate }}</eagle-col
                >
              </eagle-row>
            </div>
          </div>
        </eagle-cell>
      </template>
    </eagle-page-list>
  </div>
</template>

<script>
export default {
  data() {
    return {
      list: [],
      conditions: {},
      url: "/DangerCheckTaskDetail/GetCheckAreaDetailPageData",
      queryParams: {
        dataType: "",
        areaType: "",
        areaCode: "",
        ruCode: "",
        ctCode: "",
      },
    };
  },
  created() {
    if (this.$route.query.dataType) {
      this.queryParams.dataType = this.$route.query.dataType;
    }
    if (this.$route.query.areaType) {
      this.queryParams.areaType = this.$route.query.areaType;
    }
    if (this.$route.query.areaCode) {
      this.queryParams.areaCode = this.$route.query.areaCode;
    }
    if (this.$route.query.ctCode) {
      this.queryParams.ctCode = this.$route.query.ctCode;
    }
  },
  methods: {
    bindData(data) {
      this.list = [];
      if (data) {
        this.list = data;
      }
    },
    goDetail(item) {
      this.$router.push({
        path: "/Danger/DangerCheckDetailView",
        query: { id: item.ID },
      });
    },
  },
};
</script>

<style lang="less" scoped>
.cell-item{
  border-radius: 5px;
}
.risk {
  background-color: #e8f1f8;
  .info_search {
    padding: 10px;
    border-radius: 5px !important;
    .van-field__control {
      background-color: #ffffff !important;
    }
  }
}
.all_dep {
  background-color: #ffffff;
}
.warn_item {
  /*margin-bottom: 10px;*/
  // padding: 10px 0 10px 10px;
  border-radius: 5px;
  position: relative;
}
.warn_header {
  display: flex;
  justify-content: space-between;
  position: relative;
  margin-bottom: 10px;
  .warn_tag {
    position: absolute;
    right: 0;
    top: 0;
    border-radius: 26.64rem 0 0 26.64rem;
  }
}
.dep_sort {
  // display: flex;
  // flex-wrap: wrap;
  // margin-bottom: 5px;
  img {
    height: 15px;
    width: 15px;
    margin-right: 5px;
  }
}
.dep_btm {
  display: flex;
  justify-content: flex-end;
  .btm_item {
    display: flex;
    align-items: center;
    img {
      height: 15px;
      width: 15px;
      margin-right: 5px;
    }
  }
}

.choose_btm {
  display: flex;
  width: 100%;
  justify-content: space-between;
  position: fixed;
  bottom: 0;
  background-color: #fff;
  .choose_cancel {
    padding: 0 10px;
    display: flex;
    align-items: center;
    float: left;
  }
  .choose_confirm {
    float: right;
    border-radius: 0;
  }
}
</style>
